﻿/********************************************************************
	created:	2011-8-10   16:08
	author:		Lifan Su
	
	purpose:	implement of <cinttypes> for MSVC
*********************************************************************/

#ifndef CINTTYPES_MSVC_HPP
#define CINTTYPES_MSVC_HPP

#if !defined _CINTTYPS_HPP
#error "Don't include this heeader, include _cinttypes.hpp instead"
#endif

#if !defined _MSC_VER
#error "Unsupported platform, did you just included this header?"
#endif

#include "inttypes_msvc.h"

namespace std {

    // 7.8.2.1 The imaxabs function
#if !defined __INLINE_IMAXABS
    static
#else
    inline
#endif
        intmax_t _cdecl abs(intmax_t j) {return (j >= 0 ? j : -j);}


    // 7.8.2.2 The imaxdiv function
#if !defined __INLINE_IMAXDIV
    static
#else
    inline
#endif
        imaxdiv_t _cdecl div(intmax_t numer, intmax_t denom)
    {
        imaxdiv_t result;
        result.quot = numer / denom;
        result.rem = numer % denom;
        return result;
    }
}

#endif // CINTTYPES_MSVC_HPP